#!/usr/bin/python
"""
Author:			Jimmy Saw
Date modified:	12/25/2011

Description:    Converts Fastq file to Fasta and Qual files.

Usage:          python dissertation_ConvertFastq2FastaQual.py <Fastq> <Fasta> <Qual>

Example:
dissertation_ConvertFastq2FastaQual.py file.fastq file.fasta file.qual
"""

import sys
from Bio import SeqIO
from StringIO import StringIO

fastqfile = sys.argv[1]
fastaout = open(sys.argv[2], "w")
qualout = open(sys.argv[3], "w")

fastah = StringIO("")
qualh = StringIO("")

SeqIO.convert(fastqfile, "fastq", fastah, "fasta")
fastaout.write(fastah.getvalue())

SeqIO.convert(fastqfile, "fastq", qualh, "qual")
qualout.write(qualh.getvalue())
